<template>
  <aside>
    <!-- 节点属性 -->
    <div>
      <ul>
        <li>
          <label>节点Id</label>
          <Input
            disabled
            v-model="content.id"
            style="width: 100%"
          />
        </li>
        <li>
          <label>节点类型</label>
          <Input
            disabled
            v-model="content.type"
            style="width: 100%"
          />
        </li>
        <li>
          <label>节点名称</label>
          <Input
            v-model="content.name"
            style="width: 100%"
          />
        </li>
        <li>
          <label>汇聚方式</label>
          <el-radio-group v-model="combineDataType">
            <el-tooltip class="item" effect="light" placement="bottom-start">
              <div slot="content">
                a = [{'email':'x@x.cn'}]; <br/>
                b = [{'email':'y@y.cn'}]; <br/>
                result = [{'email':'x@x.cn'},{'email':'y@y.cn'}];
              </div>
              <el-radio :label="1">追加</el-radio>
            </el-tooltip>
            <el-tooltip class="item" effect="light" content="" placement="bottom-start">
              <div slot="content">
                a = [{'email':'x@x.cn'},{'email':'y@y.cn'}]; <br/>
                b = [{'msg':'消息'}]; <br/>
                result = [{'email':'x@x.cn','msg':'消息'},{'email:y@y.cn','msg':'消息'}]
              </div>
              <el-radio :label="2">笛卡尔积</el-radio>
            </el-tooltip>
          </el-radio-group>
        </li>

        <li>
          <label>需合并的数据变量
            <el-tooltip class="item" effect="light" placement="right">
              <template slot="content">
                多个变量用逗号分隔，如，dataList1,dataList2
              </template>
              <i class="el-icon-warning"></i>
            </el-tooltip>
          </label>
          <Input
                  v-model="content.needCombineVars"
                  style="width: 100%"
          />
        </li>
        <li>
          <label>数据存入变量
            <el-tooltip class="item" effect="light" placement="right">
              <template slot="content">
                不填此项：数据将默认存入全局变量dataList中。
              </template>
              <i class="el-icon-warning"></i>
            </el-tooltip>
          </label>
          <Input
                  v-model="content.defineVarName"
                  style="width: 100%"
          />
        </li>
        <li>
          <label>节点描述</label>
          <el-input
                  type="textarea"
                  :rows="2"
                  v-model="content.description"
                  style="width: 100%"
          />
        </li>

      </ul>
    </div>
  </aside>
</template>

<script>
export default {
  name: "ControlCombineAttr",
  props: {
    selectContent:Object
  },
  data() {
    return {
      content: {
      },
      combineDataType: 1,
      type: "",
      jspInit: this.$store.state.taskflow.jspInit,
    };
  },
  watch: {
    combineDataType(nval){
      this.content.combineDataType = nval
    },
    selectContent: {
      handler(nval) {
        if (!nval) {
          return
        }
        this.content = nval.data;
        if (this.content.combineDataType) {
          this.combineDataType = this.content.combineDataType
        }
        this.type = nval.type;
      },
      immediate: true
    }
  },
  mounted() {
  },
  methods: {
  },
};
</script>

<style scoped lang="scss">
  aside {
    padding: 10px;
    ul {
      list-style: none;
      li {
        margin-bottom: 5px;
        > label {
          display: block;
          font-size: 15px;
          font-weight: normal;
          margin-bottom: 2px;
        }
      }
    }
  }
</style>
